Skip to content

Conversation

@aleksandarskrbic
Copy link
Contributor

@aleksandarskrbic aleksandarskrbic commented Nov 22, 2025

What changes are proposed in this pull request?

Fixes #680

Avoid .unwrap() in visit_scan_metadata, replace return parameter to ExternResult<NullableCvoid>

Usage example in C:

  ExternResultNullableCvoid result = visit_scan_metadata(scan_metadata, context->engine, engine_context, scan_row_callback);
  if (result.tag != OkNullableCvoid) {
    printf("Error visiting scan metadata\n");
    exit(-1);
  }

How was this change tested?

Running read_table.c example

@codecov
Copy link

codecov bot commented Nov 22, 2025

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.76%. Comparing base (72cb27c) to head (fb4a5b1).

Files with missing lines Patch % Lines
ffi/src/scan.rs 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1526      +/-   ##
==========================================
- Coverage   84.77%   84.76%   -0.01%     
==========================================
  Files         126      126              
  Lines       35679    35682       +3     
  Branches    35679    35682       +3     
==========================================
  Hits        30246    30246              
- Misses       3965     3968       +3     
  Partials     1468     1468              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added the breaking-change Change that require a major version bump label Nov 22, 2025
@aleksandarskrbic aleksandarskrbic changed the title feat(ffi): do not panic in visit_scan_metadata feat(ffi)!: do not panic in visit_scan_metadata Nov 23, 2025
Copy link
Member

@nicklan nicklan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break the examples so we'll need to fix those too.

Copy link
Member

@nicklan nicklan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh, actually I see, it won't break them, but can we add a check that this succeeded in the examples, rather than just ignoring the result.

Copy link
Collaborator

@zachschuermann zachschuermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, for breaking changes can we explicitly call out the breaking APIs? (really helps with changelogs/releasing) thank you!

engine_context: NullableCvoid,
callback: CScanCallback,
) {
) -> ExternResult<NullableCvoid> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think visit_scan_files just returns its context. So I think we can either:

  1. return that here (like you have as NullableCvoid) and add some docs and fix the map below OR
  2. return ExternResult<()> instead and just use it to propagate the error, expecting engines to keep their context pointer around (like it would have been used before).

thoughts @nicklan? I tend to lean toward the second option for now just in the name of simplicity?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Change that require a major version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In FFI, don't panic if visit_scan_files returns an error

3 participants